package working;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

// import junit.framework.TestCase;

class Robin {
	private int i;

	public Robin(int i) {
		this.i = i;
	}

	public int call() {
		return i;
	}
}

class RoundRobin {
	private Iterator<Robin> it;
	private List<Robin> list;

	public RoundRobin(List<Robin> list) {
		this.list = list;
		it = list.iterator();
	}

	public int next() {
		// if we get to the end, start again
		if (!it.hasNext()) {
			it = list.iterator();
		}
		Robin robin = it.next();

		return robin.call();
	}
}
